﻿{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
		    <form name="myform" action="" method="post">
                <div class="box-header with-border">
                    <span class="fa fa-table" style="float:left; font-size:18px; margin-top:2px; color:#3c8dbc;" ></span>
                    <p class="box-title">{%$class_data.grade_name%}{%$class_data.class_name%}{%$semester_data.semester_name%}课程表</p>
                </div>
                    <div class="box-body">
					  <!--<div class="col-md-5 form-group">
						  <label class="col-sm-3 control-label" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
							   生效日期：
						  </label>
						  <div class="input-group col-md-5 col-xs-12">
							  <input type="text" class="form-control" name="start_time" value="{%$start_time%}" id="time">
                              <div class="input-group-addon">
							      <i class="fa fa-calendar"></i>
							  </div>
						  </div> 
						</div>
						<div class="col-md-1 col-xs-12">
						   <button type="submit" class="btn btn-primary">确 定</button>
						</div>-->
                        <table class="table table-bordered text-center" id="mytable">					 
								  <tr>
									 <td>节次</td>
									 {%foreach from=$week_lists key=key item=value%}
									 <td>{%$value.name%}</td>
									 {%/foreach%}
							      </tr>
								  {%foreach from=$am_lists key=key item=value%}
								  <tr>
										 <td>{%$key%}</td>
										 {%foreach from=$value key=k item=v%}
										 <td>
												 <select class="form-control" name="sb_{%$k%}_{%$key%}">
													<option value=""> - </option>
												 {%foreach from=$staff_slists key=t item=s%}
													<option value="{%$s.id%}" class="ss_{%$s.id%}" {%if $v.staff==$s.staff_id && $v.subject==$s.subject_id%}selected{%/if%} onclick="show({%$s.id%})"> {%$s.staff_name%} - {%$s.subject_name%}（{%$s.week_hour%}）</option>
												 {%/foreach%}
												 {%foreach from=$special_lists key=t item=s%}
													<option value="-{%$s.special_id%}"> {%$s.special_name%}</option>
												 {%/foreach%}
												 </select> 
										 </td>
										 {%/foreach%}
								 </tr>
								 {%/foreach%}
								  <tr>
								        <td>下午</td>
								  </tr>
								  {%foreach from=$pm_lists key=key item=value%}
								  <tr>
										 <td>{%$key%}</td>
										 {%foreach from=$value key=k item=v%}
										 <td>
												 <select class="form-control" name="sb_{%$k%}_{%$key%}">
													<option value=""> - </option>
												 {%foreach from=$staff_slists key=t item=s%}
													<option value="{%$s.id%}" class="ss_{%$s.id%}" {%if $v.staff==$s.staff_id && $v.subject==$s.subject_id%}selected{%/if%} onclick="show({%$s.id%})"> {%$s.staff_name%} - {%$s.subject_name%}（{%$s.week_hour%}）</option>
												 {%/foreach%}
												 {%foreach from=$special_lists key=t item=s%}
													<option value="-{%$s.special_id%}"> {%$s.special_name%}</option>
												 {%/foreach%}
												 </select>
										 </td>
										 {%/foreach%}
								 </tr>
								 {%/foreach%}
                         </table> 	
                         <p style="margin-top:10px;">提示：全部班级修改完成后点击“汇总发布”按“发布”才正式启用。</p> 
				    </div><!--box-body -->
					<div class="box-footer text-center">
						<button type="submit" class="btn btn-primary"> 确 定</button>
                        <a href="index.php?a=syllabus.gradeupdate&grade_id={%$class_data.grade_id%}" class="btn btn-success" style="float:right;">汇总发布</a>
					</div>
			    </form>
             </div><!--box box-default box-solid-->
        </section>   
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
 {%include file="index.footer.tpl.php"%}
 <script>
  $(function() {
    $( "#time" ).datepicker({
    });
  });

  function show(id){
			  var c = "ss_"+id;
			  var a = $("."+c+":selected").length; 
			  // "index.php?a=staff.HourJson&id="+id+"count="+a;
			  // 返回后更改所有c  clsss的html
              // alert(a);


			$.ajax({
			url:"index.php?a=staff.HourJson&id="+id+"&count="+a,
			type:"get",
			//data: $("."+c+":selected").length,
			dataType:"html",
			success:function(msg){
                   $("."+c).html(msg);                         		   
			    }
            });

     }
 
</script>